Add Order Fulfillment Workflow and Workflow Saga demo apps#444
Conversation
|
|
||
| <axon.version>5.1.0</axon.version> | ||
| <axoniq-framework.version>5.1.0</axoniq-framework.version> | ||
| <axon-workflow.version>1.0.0-SNAPSHOT</axon-workflow.version> |
There was a problem hiding this comment.
| <axon-workflow.version>1.0.0-SNAPSHOT</axon-workflow.version> | |
| <axon-workflow.version>0.1.0</axon-workflow.version> |
| - Java 21+ | ||
| - Maven 3.9+ | ||
| - Docker (for Axon Server) | ||
| - The Axon Workflow Engine (`io.axoniq.framework.workflow:*:1.0.0-SNAPSHOT`) installed in the local Maven repository |
There was a problem hiding this comment.
| - The Axon Workflow Engine (`io.axoniq.framework.workflow:*:1.0.0-SNAPSHOT`) installed in the local Maven repository | |
| - The Axoniq Workflow Engine (`io.axoniq.framework.workflow:*:1.0.0-SNAPSHOT`) installed in the local Maven repository |
| request payment + shipment in parallel, react to either of two payment outcomes, complete the | ||
| process — is expressed as plain imperative Java. | ||
|
|
||
| ## What got simpler |
There was a problem hiding this comment.
I'd word this section differently. It's fine to suggest things are better, but stating it like this is super on-the-nose and not in all cases entirely correct. It would come across as more honest if you also include what's better in a Saga compared to Workflows (from my pov, the massive single-method block is a massive no-no, for example).
smcvb
left a comment
There was a problem hiding this comment.
All seems fair to me, but I'd want @zambrovski to give his two cents as well before merging.
Furthermore, although it's great this is here, we have not yet updates the code-samples build with AF5 at all. So, it might be a bit early to have these modules already.
| @EventHandler | ||
| public void on(OrderPlaced event) { | ||
| var payload = new HashMap<String, Object>(); | ||
| payload.put("type", "PLACED"); |
There was a problem hiding this comment.
ObjectMapper can do it much faster by transforming a bean to Map<String, Object>.
zambrovski
left a comment
There was a problem hiding this comment.
I believe this has its own value to be presented here, independent of the visibility of examples we provide inside the module itself. This is a show case and it lives along side with other show cases.
Given the workflow-module is not public yet, I believe this one can be public before the access to the extension repository is changed to public.
So to me, if the proposed changes are applied, I see a value in publishing it here, in order to be able to show it to public already.
Co-authored-by: Steven van Beelen <steven.vanbeelen@axoniq.io>
Co-authored-by: Steven van Beelen <steven.vanbeelen@axoniq.io>
Entirely fair point, @zambrovski. Let's go for this! @schananas, would be good if the build actually is green as well, though. Would you mind spending some time on that too before we merge? |
- Bump axon-workflow dependency from 1.0.0-SNAPSHOT to released 0.1.0 in both demo poms; drop the central-portal-snapshots repository block now that the engine is on Maven Central. Fixes the red CI job. - Rename "Axon Workflow Engine" to "Axoniq Workflow Engine" across the remaining poms, READMEs, and inline comments. - Drop the now-obsolete "build the workflow engine locally first" snippet from order-fulfillment-workflow/README.md and update the Prerequisites version to 0.1.0. - Rebalance the workflow-saga README's comparison section: rename "What got simpler" to "Comparison: @saga vs @workflow", add a framing paragraph that this is a trade-off, and add explicit "Where @workflow reads more naturally" and "Where @saga reads more naturally" subsections that acknowledge the single ~70-line execute() method and the value of per-handler decomposition. - OrderEventStream: replace the manual HashMap.put chain in the OrderPlaced handler with ObjectMapper.convertValue(event, ...) plus the two extra "type"/"timestamp" entries. Uses the Jackson 3 ObjectMapper (tools.jackson.databind) autoconfigured by Spring Boot 4.
|
Review feedback addressed — see latest commit. CI should now resolve |
Summary
Two new demo modules showing how to model multi-step business processes with the Axon Workflow Engine:
order-fulfillment-workflow— order → reserve stock → payment → ship → notify. Includes a live tracking UI: Leaflet map with animated truck movement, status pills, stats panel and activity log, all driven by SSE pushed from the projection's@EventHandlers. One-click buttons trigger single orders, bursts, and failure scenarios (out-of-stock, payment-timeout).workflow-saga— saga-style order process showing wait/compensate patterns with the workflow DSL.Test plan
mvn verifyinorder-fulfillment-workflow/(Testcontainers IT spins up Axon Server)mvn verifyinworkflow-saga/mvn spring-boot:runinorder-fulfillment-workflow/, open http://localhost:9090/, click "Stress test ×25" and "Mixed burst" — markers should animate end-to-end on the map